import React from 'react'
import { Button } from 'antd'
import style from '../styles/Home.module.scss'
import { useNavigate } from 'react-router-dom'
import { LIST_PATH } from '../roters'
import { useRequest } from 'ahooks'
import { getQuestionStatisticsFun } from '../api/list'
export default function Home() {
  const nav = useNavigate()
  const { data } = useRequest(getQuestionStatisticsFun)
  const goHome = () => {
    nav(LIST_PATH)
  }

  return (
    <div className={style.content}>
      <h1>问卷调查 | 在线投票</h1>
      <div>
        已累计创建问卷 {data?.data.questionTotal} 份，发布问卷 {data?.data.published} 份，收到答卷 {data?.data.answered} 份
      </div>
      <Button size="large" type="primary" onClick={goHome}>
        开始使用
      </Button>
    </div>
  )
}
